#ifndef CONFIGMANAGER_H
#define CONFIGMANAGER_H

#include <string>
#include <QString>

class ConfigManager
{
private:
    static ConfigManager instance;

    ConfigManager();
    ~ConfigManager();
    ConfigManager(const ConfigManager&)=delete;
    ConfigManager& operator=(const ConfigManager&)=delete;

public:
    static ConfigManager& getInstance() {
        return instance;
    }

private:
    /**
     * 浏览器配置信息
     */
    std::string defautlIndex = "https://www.baidu.com";     // 默认加载主页
    unsigned int defaultWindowHeight = 600;     // 默认主窗口高度
    unsigned int defaultWindowWidth = 800;      // 默认主窗口宽度

    /**
     * 密码管理器配置信息
     */
    std::string pub_key_path = "";          // 公钥路径，存储与文件中，用于加密账号密码数据

    /**
     * 检测服务器地址信息
     */
    std::string serverPath = "http://localhost:8888";

    /**
     * 默认文件下载路径
     */
    QString downloadPath = "D:\\safe_browser_download";

    /**
     * 默认插件路径
     */
    QString pluginPath = "D:\\safe_browser_plugin";
    /**
    * 开启无痕模式，不保存历史记录,和chromium内核保持一致
    */
    bool traceless = false;

public:
    //对外开放的更新配置的接口
    const std::string &getDefaultIndex(){return defautlIndex;}
    void setDefaultIndex(std::string s){defautlIndex = s;}

    unsigned getDefaultWindowHeight(){return defaultWindowHeight;}
    unsigned getDefaultWindowWidth(){return defaultWindowWidth;}
    void setServerPath(std::string _serverPath){serverPath = _serverPath;}
    std::string getServerPath(){return serverPath;}

    QString getDownloadPath(){return downloadPath;}

    QString getPluginPath(){return pluginPath;}

    bool getTraceLess(){return traceless;};
    void setTraceLess(bool _traceLess){this->traceless = _traceLess;}
};

#endif // CONFIGMANAGER_H
